package com.jbinfo.mgosql.controller;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.jbinfo.mgosql.operation.company.model.Company;
import com.jbinfo.mgosql.operation.company.service.CompanyService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import net.siufung.boot.mybatis.intercetpor.Pagination;

@RestController
@RequestMapping("/company")
@Api("company相关的API")
public class CompanyController {
	
	@Autowired
	private CompanyService companyService;
	
	/*@ApiOperation("增加一个Company")
	@RequestMapping(value = "/add", method = RequestMethod.GET)
	public void addSimpleDto(
			@ModelAttribute Company company) {
		companyService.insert(company);
    }*/
	
	@ApiOperation("获取所有的Company")
	@RequestMapping(value = "/getAll", method = RequestMethod.GET)
	@ResponseBody
	public List<Company> getAll() {
	     return companyService.findList();
	}
	
	@ApiOperation("根据uid获取Company")
	@RequestMapping(value = "/findByUid", method = RequestMethod.GET)
	@ResponseBody
	public Company findByUid(String uid,HttpServletRequest request) {
		 uid = request.getParameter("uid");
	     return companyService.findByUid(uid);
	}
	
	/*@ApiOperation("Company分页")
	@RequestMapping(value = "/getPage", method = RequestMethod.GET)
	public Pagination<Company> getPage(@ModelAttribute Company company) {
		Pagination<Company> pagination=companyService.getPage(company);
		return pagination;
	}*/
	
	
	
	
}
